<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
  <xsl:output method="html" />
  <xsl:include href="Common.xsl"/>

  <xsl:template match="/">
    <html>
      <head>
        <title>Weather forcecast</title>
      </head>
      <body>
        <xsl:apply-templates />
      </body>
    </html>
  </xsl:template>

  <xsl:template name="ccWeather" match="weather">
    <xsl:apply-templates select="head"/>
    <xsl:apply-templates select="loc"/>
    <xsl:apply-templates select="dayf"/>
    <xsl:apply-templates select="lnks"/>
  </xsl:template>

  <xsl:template match="dayf">
    <!--LastObservationDateTime: <xsl:value-of select="lsup" /> <br />-->
    <table>
      <tr>
      <xsl:apply-templates select="day" />
      </tr>        
    </table>
  </xsl:template>

  <xsl:template match="day">
    <td>
      <table>
        <tr>
          <th colspan="2">
          <xsl:choose>
            <xsl:when test="@d=0">Today</xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="@t" />
            </xsl:otherwise>
          </xsl:choose>
          <!--Day No.:  <xsl:value-of select="@d" />  <br />-->
          <!--Weekday:  <xsl:value-of select="@t" />  <br />-->
          </th>
        </tr>
        <tr>
          <th colspan="2"><xsl:value-of select="@dt" /></th>
        </tr>
        <tr>
          <td>
            High 
          </td>
          <td>
            <xsl:value-of select="hi" />° <xsl:copy-of select="$TemperatureUnit" />
          </td>
        </tr>
        <tr>
          <td>
            Low
          </td>
          <td>
            <xsl:value-of select="low" />° <xsl:copy-of select="$TemperatureUnit" />
          </td>
        </tr>
        <tr>
          <td>Sunrise</td>
          <td>
            <xsl:value-of select="sunr" />
          </td>
        </tr>
        <tr>
          <td>Sunset</td>
          <td>
            <xsl:value-of select="suns" />
          </td>
        </tr>
        <xsl:apply-templates select="part"/>
      </table>
    </td>
  </xsl:template>

  <xsl:template match="part">
    <tr>
      <td colspan="2">
        <b>
        <xsl:choose> 
          <xsl:when test="@p='d'">Day</xsl:when>
          <xsl:when test="@p='n'">Night</xsl:when>
        </xsl:choose>
        </b>
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <!--Description-->
        <xsl:value-of select="t" />
        <!--Short description: <xsl:value-of select="bt" /> <br />-->
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <xsl:apply-templates select="icon"/>
        <!--Icon: <xsl:value-of select="icon" /> <br />-->
      </td>
    </tr>
    <tr>
      <td>Wind</td>
      <td><xsl:apply-templates select="wind"/></td>
    </tr>
    <tr>
      <td>Humidity</td>
      <td><xsl:value-of select="hmid" /> %</td>
    </tr>
    <tr>
      <td>Chance of Precip</td>
      <td><xsl:value-of select="ppcp" /> %</td>
    </tr>
  </xsl:template>
</xsl:stylesheet>
